<?php

/**
 * Description of OneToManyInsert
 *
 * @author Rino7
 */
class OneToManyInsert extends Insert {
    
    private $_keyField = array("name" => "id", "value" => "");
    	/**
	 * @todo Agregar algun atributo tipo $camposClavesAdicionales para poder filtrar por otros 
	 * campos ademas del 'id', por ejemplo activo, estado, etc.
	 */

    public function begin() {
        $this->_query = "DELETE FROM $this->_tableName WHERE $this->_keyField['name'] = '$this->_keyField['value']'";
        SQLHelper::getInstancia()->executeDeleteQuery($this->_query);
        $this->_query = "INSERT INTO $this->tabla SET $this->_keyField['name'] = $this->_keyField['value'] ";
    }
    /*
    * agregarCampo y end lo heredo de Insert
    */
    public function setKeyFieldName($keyFieldName) {
        $this->_keyField['name'] = $keyFieldName;
    }
	
    public function setKeyFieldValue($keyFieldValue) {
        $this->_keyField['value'] = $keyFieldValue;
    }
}